/**
 * 
 */
package com.cow.support.util;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;

/**
 * @author gaozl
 *
 */
public class FileUtils {
	
	/**
	 * �ļ�����
	 * @param orgin
	 * @param target
	 * @throws IOException 
	 */
	public static int copy(File orgin, File target) throws IOException{
		
	
			InputStream reader = new FileInputStream(orgin);
			OutputStream writer = new FileOutputStream(target);
			int len  = reader.available();
			byte[] buf = new byte[len];
			reader.read(buf);
			writer.write(buf);
			writer.flush();
			buf = null;
			reader.close();
			writer.close();
			return len;
			

	}
   public static void delFile(String filePath,String fileName){
	   
	   File file  = new File(filePath+fileName);
	   if(file.exists()){
		   file.delete();
	   }
   }
}
